package pl.uz.zgora.plan;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ClickTipViewActivity extends Activity {
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.click_tip_view);
	    
	    final Intent intent = new Intent(this, MainMenuActivity.class);
	    
	    final Bundle intentParams = getIntent().getExtras();
	    final String selectedGroupName = intentParams.getString("nazwaGrupy");
		final String selectedTeacherName = intentParams.getString("nazwaNauczyciela");
		
		if(selectedGroupName != null){
        	Integer selectedGroupId = intentParams.getInt("idGrupy");
        	
        	intent.putExtra("idGrupy", selectedGroupId);
			intent.putExtra("nazwaGrupy", selectedGroupName);
        } else if(selectedTeacherName != null) {
        	Integer selectedTeacherId =  intentParams.getInt("idNauczyciela");
        	
        	intent.putExtra("idNauczyciela", selectedTeacherId);
    		intent.putExtra("nazwaNauczyciela", selectedTeacherName);
        }
	    
		intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
	    
	    final Button okBtn = (Button) findViewById(R.id.click_tip_btn);
	    okBtn.setOnClickListener(new OnClickListener() {
			
			public void onClick(View arg0) {
				startActivity(intent);
				finish();
			}
		});
	}
}
